// -*- c++ -*-
/*
 * C++ <type_traits> header
 *
 * This file is part of PanicOS.
 *
 * PanicOS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PanicOS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PanicOS.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef _LIBCPP_TYPE_TRAITS
#define _LIBCPP_TYPE_TRAITS

namespace std {
	// helper classes
	template <class T, T v> struct integral_constant {
		typedef T value_type;
		typedef std::integral_constant<T, v> type;

	public:
		static constexpr T value = v;
		constexpr operator value_type() const noexcept {
			return value;
		}

		constexpr value_type operator()() const noexcept {
			return value;
		}
	};

	template <bool B> using bool_constant = integral_constant<bool, B>;

	using true_type = std::integral_constant<bool, true>;
	using false_type = std::integral_constant<bool, false>;

	// references
	template <class T> struct remove_reference {
		typedef T type;
	};

	template <class T> struct remove_reference<T &> {
		typedef T type;
	};

	template <class T> struct remove_reference<T &&> {
		typedef T type;
	};

	template <class T> using remove_reference_t = typename remove_reference<T>::type;

} // namespace std

#endif
